Page({


  data: {},

  onLoad: function (options) {
    this.setData({
      goods_id: options.id,
    })
    this.requestData(options.id)
  },
  AgainRequest(e) {
    this.requestData(this.data.goods_id)
  },
  requestData(e) {
    var _this = this
    wx.showLoading({
      type: "loading..."
    })
    getApp().request({
      url: getApp().api.auction.detail,
      method: "GET",
      data: {
        auction_id: e
      },
      success(res) {
        wx.hideLoading()
        // 价格
        if (res.data.detail.status == 0) {
          var price = res.data.detail.auction_price
        } else if (res.data.detail.status == 1) {
          if (res.data.bid_list.list.length == 0) {
            var price = res.data.detail.auction_price
          } else {
            var price = res.data.bid_list.list[0].bid
          }
        } else if (res.data.bid_list.length == 3) {
          var price = res.data.detail.end_bid
        }
        // 时间
        if (res.data.detail.status == 0) {
          var time = res.data.detail.start_time
        } else if (res.data.detail.status == 1) {
          var time = res.data.detail.end_time
        }
        wx.setNavigationBarTitle({
          title: res.data.detail.name
    })
        _this.setData({
          goodsPicList: res.data.detail.goods.goodsPicList,
          status: res.data.detail.status,
          price: price,
          time: time,
          name: res.data.detail.name,
          auction_price: res.data.detail.auction_price,
          auction_range: res.data.detail.auction_range,
          support: res.data.detail.support,
          auction_type: res.data.detail.auction_type,
          mch: res.data.mch,
          bid_list: res.data.bid_list,
          is_warn:res.data.detail.is_warn
        })
      },
      fail(res) {
        console.log(res)
      }
    })
  }
})